﻿using System;
using System.Collections;
using Assets.Script.NetSystem.Services.HallService;
using Script.UiSystem.Hall;
using SimpleTools.Net.SimpleServer.UDP;
using UnityEngine;

namespace Script.UiSystem
{
    public class HallManager : MonoBehaviour
    {
        
        private void Start()
        {
            HallController.Instance.HallClient = new HallClient(NetConst.Port,"连接大厅", delegate
            {
                HallController.Instance.HallClient.GetRoomsList("Case01");
            });
        }

        public void CreateRoom()
        {
            print("create room");
            HallController.Instance.HallClient.CreateRoom();
        }

        public void JoinRoom()
        {
            print("join room");
            
        }

        private void FixedUpdate()
        {
            // HallController.Instance.HallClient?.ClientPoll();
        }

        private void OnDestroy()
        {
            HallController.Instance.HallClient.ClientStop();
        }
    }
}